import { createBrowserRouter, Navigate } from 'react-router-dom'
import App from '@/App'
import Login from '@/pages/login'
import Index from '@/pages/index'
import Home from '@/pages/home'
import About from '@/pages/aboutUs'
import Main from '@/pages/main'
import IFlytek from '@/pages/main/children/iFlytek'
import Text from '@/pages/main/children/text'
import Class from '@/pages/main/children/class'
import Face from '@/pages/main/children/face'
import User from '@/pages/main/children/user'
import NotFound from '@/pages/notFound'

const Router = createBrowserRouter([
  {
    path: '/',
    element: <App />,
    children: [
      {
        path: '',
        element: <Index />,
        children: [
          {
            path: '',
            element: <Home />,
          },
          {
            path: 'about',
            element: <About />,
          },
        ],
      },
    ],
  },
  {
    path: '/login',
    element: <Login />,
  },
  {
    path: '/main',
    element: <Main />,
    children: [
      {
        path: '',
        element: <Navigate to="iFlytek" replace />,
      },
      {
        path: 'iFlytek',
        element: <IFlytek />,
      },
      {
        path: 'text',
        element: <Text />,
      },
      {
        path: 'class',
        element: <Class />,
      },
      {
        path: 'face',
        element: <Face />,
      },
      {
        path: 'user',
        element: <User />,
      },
    ],
  },
  {
    path: '*',
    element: <NotFound />,
  },
])

export default Router
